﻿Public Class MonAnDuocDat_BLL
    Public Sub Them(ByVal monAnDat As MonAnDat)
        Dim db As New QLTCDataContext
        Dim query = From mon_AnDat In db.MonAnDats
                    Select mon_AnDat.ID
        Dim lc = 0
        For i As Integer = 0 To query.ToList.Count - 1
            If query.ToList.Item(i) > lc Then
                lc = query.ToList.Item(i)
            End If
        Next
        monAnDat.ID = lc + 1
        db.MonAnDats.InsertOnSubmit(monAnDat)
        db.SubmitChanges()
    End Sub

End Class
